<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html; charset=utf-8" />
<TITLE>RTW Report - Simulator.c </TITLE>
</HEAD>
<BODY BGCOLOR="#eeeeee" TEXT="#1122aa" ONLOAD="if (top) { if (top.rtwFileOnLoad) top.rtwFileOnLoad(window);}">
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" WIDTH="100%" HEIGHT="100%"><TR><TD WIDTH="100%" VALIGN="top" BGCOLOR="#ffffff">
<H4>File: <A HREF="file:///home/ying/Documents/lockheed/codegen/mex/sphere_on_sphere/Simulator.c" TARGET="rtwreport_document_frame">/home/ying/Documents/lockheed/codegen/mex/sphere_on_sphere/Simulator.c</A></H4>
<PRE id="RTWcode">
<A NAME="1"><FONT COLOR="#888888"><I>    1   </I></FONT></A><FONT COLOR="#117755"><I>/*</I></FONT>
<A NAME="2"><FONT COLOR="#888888"><I>    2   </I></FONT></A><FONT COLOR="#117755"><I> * Simulator.c</I></FONT>
<A NAME="3"><FONT COLOR="#888888"><I>    3   </I></FONT></A><FONT COLOR="#117755"><I> *</I></FONT>
<A NAME="4"><FONT COLOR="#888888"><I>    4   </I></FONT></A><FONT COLOR="#117755"><I> * Code generation for function 'Simulator'</I></FONT>
<A NAME="5"><FONT COLOR="#888888"><I>    5   </I></FONT></A><FONT COLOR="#117755"><I> *</I></FONT>
<A NAME="6"><FONT COLOR="#888888"><I>    6   </I></FONT></A><FONT COLOR="#117755"><I> * C source code generated on: Sat Oct 18 11:56:05 2014</I></FONT>
<A NAME="7"><FONT COLOR="#888888"><I>    7   </I></FONT></A><FONT COLOR="#117755"><I> *</I></FONT>
<A NAME="8"><FONT COLOR="#888888"><I>    8   </I></FONT></A><FONT COLOR="#117755"><I> */</I></FONT>
<A NAME="9"><FONT COLOR="#888888"><I>    9   </I></FONT></A>
<A NAME="10"><FONT COLOR="#888888"><I>   10   </I></FONT></A><FONT COLOR="#117755"><I>/* Include files */</I></FONT>
<A NAME="11"><FONT COLOR="#888888"><I>   11   </I></FONT></A><FONT COLOR="#992211">#</FONT><FONT COLOR="#992211"><B>include</B></FONT> <FONT COLOR="#992211">&quot;rt_nonfinite.h&quot;</FONT>
<A NAME="12"><FONT COLOR="#888888"><I>   12   </I></FONT></A><FONT COLOR="#992211">#</FONT><FONT COLOR="#992211"><B>include</B></FONT> <FONT COLOR="#992211">&quot;sphere_on_sphere.h&quot;</FONT>
<A NAME="13"><FONT COLOR="#888888"><I>   13   </I></FONT></A><FONT COLOR="#992211">#</FONT><FONT COLOR="#992211"><B>include</B></FONT> <FONT COLOR="#992211">&quot;Simulator.h&quot;</FONT>
<A NAME="14"><FONT COLOR="#888888"><I>   14   </I></FONT></A>
<A NAME="15"><FONT COLOR="#888888"><I>   15   </I></FONT></A><FONT COLOR="#117755"><I>/* Type Definitions */</I></FONT>
<A NAME="16"><FONT COLOR="#888888"><I>   16   </I></FONT></A>
<A NAME="17"><FONT COLOR="#888888"><I>   17   </I></FONT></A><FONT COLOR="#117755"><I>/* Named Constants */</I></FONT>
<A NAME="18"><FONT COLOR="#888888"><I>   18   </I></FONT></A>
<A NAME="19"><FONT COLOR="#888888"><I>   19   </I></FONT></A><FONT COLOR="#117755"><I>/* Variable Declarations */</I></FONT>
<A NAME="20"><FONT COLOR="#888888"><I>   20   </I></FONT></A>
<A NAME="21"><FONT COLOR="#888888"><I>   21   </I></FONT></A><FONT COLOR="#117755"><I>/* Variable Definitions */</I></FONT>
<A NAME="22"><FONT COLOR="#888888"><I>   22   </I></FONT></A>
<A NAME="23"><FONT COLOR="#888888"><I>   23   </I></FONT></A><FONT COLOR="#117755"><I>/* Function Declarations */</I></FONT>
<A NAME="24"><FONT COLOR="#888888"><I>   24   </I></FONT></A>
<A NAME="25"><FONT COLOR="#888888"><I>   25   </I></FONT></A><FONT COLOR="#117755"><I>/* Function Definitions */</I></FONT>
<A NAME="26"><FONT COLOR="#888888"><I>   26   </I></FONT></A>
<A NAME="27"><FONT COLOR="#888888"><I>   27   </I></FONT></A><FONT COLOR="#112266"><B>void</B></FONT> <A NAME="fcn_Simulator">Simulator</A>(real_T varargin_1, <A HREF="sphere_on_sphere_types_h.html#type_struct_T" ONCLICK="if (top) if (top.docHiliteMe) top.docHiliteMe(window, 'var_struct_T');" TARGET="rtwreport_document_frame"><FONT COLOR="#1122aa">struct_T</FONT></A> *sim)
<A NAME="28"><FONT COLOR="#888888"><I>   28   </I></FONT></A><B>{</B>
<A NAME="29"><FONT COLOR="#888888"><I>   29   </I></FONT></A>    int32_T i;
<A NAME="30"><FONT COLOR="#888888"><I>   30   </I></FONT></A>    <FONT COLOR="#112266"><B>static</B></FONT> <FONT COLOR="#112266"><B>const</B></FONT> real_T dv1[3] = <B>{</B> 0.0, 0.0, -9.81 <B>}</B>;
<A NAME="31"><FONT COLOR="#888888"><I>   31   </I></FONT></A>    <FONT COLOR="#117755"><I>/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */</I></FONT>
<A NAME="32"><FONT COLOR="#888888"><I>   32   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  RPI-MATLAB-Simulator */</I></FONT>
<A NAME="33"><FONT COLOR="#888888"><I>   33   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  http://code.google.com/p/rpi-matlab-simulator/ */</I></FONT>
<A NAME="34"><FONT COLOR="#888888"><I>   34   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  */</I></FONT>
<A NAME="35"><FONT COLOR="#888888"><I>   35   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Creates a Simulator struct containing simulation properties */</I></FONT>
<A NAME="36"><FONT COLOR="#888888"><I>   36   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  The simulator struct */</I></FONT>
<A NAME="37"><FONT COLOR="#888888"><I>   37   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim = struct();  */</I></FONT>
<A NAME="38"><FONT COLOR="#888888"><I>   38   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Simulator properties */</I></FONT>
<A NAME="39"><FONT COLOR="#888888"><I>   39   </I></FONT></A>    sim-&gt;time = 0.0;
<A NAME="40"><FONT COLOR="#888888"><I>   40   </I></FONT></A>    sim-&gt;step = 0.0;
<A NAME="41"><FONT COLOR="#888888"><I>   41   </I></FONT></A>    sim-&gt;MAX_STEP = 1.0E+9;
<A NAME="42"><FONT COLOR="#888888"><I>   42   </I></FONT></A>    sim-&gt;gravity = TRUE;
<A NAME="43"><FONT COLOR="#888888"><I>   43   </I></FONT></A>    <FONT COLOR="#112266"><B>for</B></FONT> (i = 0; i &lt; 3; i++) <B>{</B>
<A NAME="44"><FONT COLOR="#888888"><I>   44   </I></FONT></A>        sim-&gt;gravityVector[i] = dv1[i];
<A NAME="45"><FONT COLOR="#888888"><I>   45   </I></FONT></A>    <B>}</B>
<A NAME="46"><FONT COLOR="#888888"><I>   46   </I></FONT></A>    sim-&gt;jointCorrection = FALSE;
<A NAME="47"><FONT COLOR="#888888"><I>   47   </I></FONT></A>    sim-&gt;record = FALSE;
<A NAME="48"><FONT COLOR="#888888"><I>   48   </I></FONT></A>    sim-&gt;record_fileID = -1.0;
<A NAME="49"><FONT COLOR="#888888"><I>   49   </I></FONT></A>    sim-&gt;FRICTION = TRUE;
<A NAME="50"><FONT COLOR="#888888"><I>   50   </I></FONT></A>    sim-&gt;num_fricdirs = 7.0;
<A NAME="51"><FONT COLOR="#888888"><I>   51   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  A function handle to a user function */</I></FONT>
<A NAME="52"><FONT COLOR="#888888"><I>   52   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim.userData = struct;      % A struct for storing user data */</I></FONT>
<A NAME="53"><FONT COLOR="#888888"><I>   53   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Body properties */</I></FONT>
<A NAME="54"><FONT COLOR="#888888"><I>   54   </I></FONT></A>    sim-&gt;num_bodies = 0.0;
<A NAME="55"><FONT COLOR="#888888"><I>   55   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Function handles */</I></FONT>
<A NAME="56"><FONT COLOR="#888888"><I>   56   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim.H_collision_detection = @collision_detection;  */</I></FONT>
<A NAME="57"><FONT COLOR="#888888"><I>   57   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim.H_dynamics = @LCPdynamics; */</I></FONT>
<A NAME="58"><FONT COLOR="#888888"><I>   58   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim.H_solver = @pathsolver;  */</I></FONT>
<A NAME="59"><FONT COLOR="#888888"><I>   59   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Use PATH's courtesy license if one isn't set already. */</I></FONT>
<A NAME="60"><FONT COLOR="#888888"><I>   60   </I></FONT></A>    <FONT COLOR="#117755"><I>/*      if isempty(getenv('PATH_LICENSE_STRING')) */</I></FONT>
<A NAME="61"><FONT COLOR="#888888"><I>   61   </I></FONT></A>    <FONT COLOR="#117755"><I>/*          setenv('PATH_LICENSE_STRING','2069810742&Courtesy_License&&&USR&2013&14_12_2011&1000&PATH&GEN&31_12_2013&0_0_0&0&0_0'); */</I></FONT>
<A NAME="62"><FONT COLOR="#888888"><I>   62   </I></FONT></A>    <FONT COLOR="#117755"><I>/*      end */</I></FONT>
<A NAME="63"><FONT COLOR="#888888"><I>   63   </I></FONT></A>    <FONT COLOR="#117755"><I>/* sim.dynamics = struct; */</I></FONT>
<A NAME="64"><FONT COLOR="#888888"><I>   64   </I></FONT></A>    sim-&gt;num_jointConstraints = 0.0;
<A NAME="65"><FONT COLOR="#888888"><I>   65   </I></FONT></A>    sim-&gt;num_activeJointBodies = 0.0;
<A NAME="66"><FONT COLOR="#888888"><I>   66   </I></FONT></A>    sim-&gt;num_activeBodies = 0.0;
<A NAME="67"><FONT COLOR="#888888"><I>   67   </I></FONT></A>    sim-&gt;num_dynamicBodies = 0.0;
<A NAME="68"><FONT COLOR="#888888"><I>   68   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Store solution error */</I></FONT>
<A NAME="69"><FONT COLOR="#888888"><I>   69   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Collision detection properties */</I></FONT>
<A NAME="70"><FONT COLOR="#888888"><I>   70   </I></FONT></A>    sim-&gt;epsilon = 0.05;
<A NAME="71"><FONT COLOR="#888888"><I>   71   </I></FONT></A>    <FONT COLOR="#117755"><I>/*  Graphics properties */</I></FONT>
<A NAME="72"><FONT COLOR="#888888"><I>   72   </I></FONT></A>    sim-&gt;figure = 1.0;
<A NAME="73"><FONT COLOR="#888888"><I>   73   </I></FONT></A>    sim-&gt;draw = TRUE;
<A NAME="74"><FONT COLOR="#888888"><I>   74   </I></FONT></A>    sim-&gt;drawContacts = FALSE;
<A NAME="75"><FONT COLOR="#888888"><I>   75   </I></FONT></A>    sim-&gt;drawBoundingBoxes = FALSE;
<A NAME="76"><FONT COLOR="#888888"><I>   76   </I></FONT></A>    sim-&gt;drawJoints = FALSE;
<A NAME="77"><FONT COLOR="#888888"><I>   77   </I></FONT></A>    <FONT COLOR="#117755"><I>/*     %% Parse input arguments */</I></FONT>
<A NAME="78"><FONT COLOR="#888888"><I>   78   </I></FONT></A>    sim-&gt;h = 0.01;
<A NAME="79"><FONT COLOR="#888888"><I>   79   </I></FONT></A><B>}</B>
<A NAME="80"><FONT COLOR="#888888"><I>   80   </I></FONT></A><FONT COLOR="#117755"><I>/* End of code generation (Simulator.c) */</I></FONT>
<A NAME="81"><FONT COLOR="#888888"><I>   81   </I></FONT></A></PRE>
</TD></TR></TABLE>
</P>
</BODY>
</HTML>